<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" import="java.util.*,comm.*,bean.*,dao.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/layui/css/layui.css"
	media="all">
<script type="text/javascript" charset="utf-8"
	src="${pageContext.request.contextPath}/layui/layui.js"></script>
</head>


<body>
<%
	request.setCharacterEncoding("utf-8");
	String type_id1 = request.getParameter("type_id");
	int type_id = Integer.parseInt(type_id1);
	
	Type type = new Type();
	TypeDao dao = new TypeDao();
	
	type = dao.getTypeByType_id(type_id);
	String type_name = type.getType_name();
	String type_desc = type.getType_desc();
	
// 	System.out.print(type_id+"55555555");
// 	System.out.print(type_name+"6666");
// 	System.out.print(type_desc+"6666");

%>

	<h2>修改商品类型</h2>
	<br><br><br>
	<form class="layui-form" action="${pageContext.request.contextPath}/ModifyGoodsType?type_id=<%=type_id %>" method="post" >
		<div type="width:700px;height:300px;"></div>
		
			<div class="layui-form-item" type="margin-top:300px;">
				<label class="layui-form-label">商品类型</label>
				<div class="layui-input-block">
					<input type="text" name="type_name" lay-verify="title"
						autocomplete="off" value="<%=type_name %> " class="layui-input">
				</div>
			</div>


			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">商品简介</label>
				<div class="layui-input-block">
					<textarea class="layui-textarea layui-hide" name="type_desc" value="<%=type_desc %>"
						 id="LAY_demo_editor"></textarea>
				</div>
			</div>

			<div class="layui-form-item">
				<div class="layui-input-block">
					<button type="submit" class="layui-btn" lay-submit=""
						lay-filter="demo1">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
	
	</form>

	<script>
		layui
				.use(
						[ 'form', 'layedit', 'laydate' ],
						function() {
							var form = layui.form, layer = layui.layer, layedit = layui.layedit, laydate = layui.laydate;

							//日期
							laydate.render({
								elem : '#date'
							});
							laydate.render({
								elem : '#date1'
							});

							//创建一个编辑器
							var editIndex = layedit.build('LAY_demo_editor');

							//自定义验证规则
							form.verify({
								title : function(value) {
									if (value.length < 1) {
										return '请输入商品名称';
									}
								},
								pass : [ /^[\S]{6,12}$/, '密码必须6到12位，且不能出现空格' ],
								content : function(value) {
									layedit.sync(editIndex);
								}
							});

							//表单赋值
							layui.$('#LAY-component-form-setval').on('click',
									function() {
										form.val('example', {
											"username" : "贤心" // "name": "value"
											,
											"password" : "123456",
											"interest" : 1,
											"like[write]" : true //复选框选中状态
											,
											"close" : true //开关状态
											,
											"sex" : "女",
											"desc" : "我爱 layui"
										});
									});

							//表单取值
							layui.$('#LAY-component-form-getval').on('click',
									function() {
										var data = form.val('example');
										alert(JSON.stringify(data));
									});

						});
	</script>


	<script>
		//Demo
		layui.use('form', function() {
			var form = layui.form;

			//监听提交
			form.on('submit(formDemo)', function(data) {
				layer.msg(JSON.stringify(data.field));
				return false;
			});
		});
	</script>



</body>
</html>